package com.example.madplayer;

import java.util.ArrayList;
import java.util.List;

import android.app.ListActivity;
import android.app.TabActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ListView;

@SuppressWarnings("deprecation")
public class MenuListActivity extends ListActivity {
	private List<String> menu_list;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		setContentView(R.layout.common_listview);
		super.onCreate(savedInstanceState);
		initListAdapter();
	}
	
	private void initListAdapter() {
		menu_list = new ArrayList<String>();
		menu_list.add("L");
		menu_list.add("P");
		setListAdapter(new MenuListAdapter(this, menu_list));
	}

	@Override
	protected void onPause() {
		super.onPause();
	}

	@Override
	protected void onResume() {
		super.onResume();
	}
	
	@Override
	protected void onListItemClick(ListView paramListView, View paramView,
			int paramInt, long paramLong) {
		super.onListItemClick(paramListView, paramView, paramInt, paramLong);
		switch (paramInt) {
		case 0: {
			toNextActivity(paramInt, Constants.TAB_SPEC_TAG.AUDIO_LIST_SPEC_TAG
					.getId(), Constants.TAB_SPEC_TAG.AUDIO_LIST_SPEC_TAG
					.getId());
			break;
		}
		case 1: {
			toNextActivity(paramInt, Constants.TAB_SPEC_TAG.PLAYLIST_SPEC_TAG
					.getId(), Constants.TAB_SPEC_TAG.PLAYLIST_SPEC_TAG.getId());
			break;
		}
		default: {
			break;
		}
		}
	}
	
	
	private void toNextActivity(int paramInt, String tag, String label) {
		TabActivity tabActivity = (TabActivity) getParent();
		tabActivity.getTabHost().setCurrentTabByTag(tag);
	}
}
